//字符参数
function sayHelo(name = "Tom"){
    console.log(`Helo ${name}`);
}
sayHelo();//Helo Tom
sayHelo("jak");//Helo jak

//数值计算
function add(a=1, b=a){
    return a+b;
}
console.log(add());//2
console.log(add(10));//20
console.log(add(10, 20));//30

//必须指定参数
function required(){
	console.log("参数未制定");
   throw new Error("参数未制定");
  
}
function sayBye(name=required()){
    console.log(`${name} bye!`);
}
sayBye('张三');//张三 bye!
sayBye();//参数未制定||undefined bye!||Error
